package shopping;

import java.util.Scanner;

public class Main {
    static Project[] projects = new Project[]{
        new Project("雪碧", "饮品", 3, 100),
        new Project("可乐", "饮品", 3, 100),
        new Project("果汁", "饮品", 3, 100),
        new Project("牛奶", "饮品", 2.5, 100),
        new Project("苹果", "水果", 1.9, 100),
        new Project("香蕉", "水果", 2.1, 100),
        new Project("面包", "食品", 3.5, 100),
        new Project("好吃的面包", "奢侈品", 10, 100),
        new Project("\"原神,启动!\"", "非卖品", 100000000, 100)
    };
    public static void main(String[] args) {
        int flag = 0;
        System.out.println("欢迎来到购物车系统");
        ShoppingCart cart = new ShoppingCart();
        while(flag==0) {
            System.out.println("以下是本店所有商品(具体信息将在购买时出现)");
            for (Project project : projects) {
                System.out.print(project.getName()+"  ");
            }
            System.out.println();
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入您的选择\"购物/删除购物车中某商品/查看购物车中已有商品/结账\"(1/2/3/4)");
            int choice = scanner.nextInt();
            switch (choice) {
                case 1:
                    flag = cart.ShoppingBuy();
                    break;
                case 2:
                    cart.Shoppingdel();
                    break;
                case 3:
                    cart.Shoppinglook();
                    break;
                case 4: {
                    flag = cart.Shoppingfinish();
                    break;
                }
                default:{
                    System.out.println("输入了非法数据,任务失败");
                }
            }
        }
    }
}
